package main

import "fmt"

/*
	求两个3*3矩阵的和并输出（数据都是int类型）
	解析：矩阵的和计算规则是对应元素相加：
	c[i][j] = a[i][j] + b[i][j]
*/

func main() {
	var a = [3][3]int{
		{1, 2, 3},
		{4, 5, 6},
		{7, 8, 9}}
	var b = [3][3]int{
		{1, 2, 3},
		{4, 5, 6},
		{7, 8, 9}}
	sum(a, b)
}

func sum(a [3][3]int, b [3][3]int) {
	c := [3][3]int{}
	for i := 0;i < 3;i++{
		for j := 0; j < 3;j++ {
			c[i][j] = a[i][j] + b[i][j]
		}
	}
	for _, v := range c{
		fmt.Printf("%d\n",v)
	}
}